﻿/********************************************************************************************************
  1. 스토어드명		: SP_MAPPINGINFO_CUD
  2. 목적 & 기능		: Standard code에 Mapping 연결
  3. 생성일자		: 2014.07.07
  4. 생성자 			: 조범준
  5. Used DB Name	: DB_EDUC
  6. Used DB Table	:
						Read	- STDCODE_GROUP_MAPPING A
  7. 실행			:
						SP_MAPPINGTABLE_R, ''
********************************************************************************************************/
----------------------------------------------------------------------------------------------------------
CREATE OR REPLACE PROCEDURE SP_MAPPINGINFO_CUD
(
	iJOBMODE			IN	VARCHAR2,
	iOBJECTID			IN	NUMBER,
	iGROUPOBJECTID		IN	NUMBER,
	iMAPPINGOBJECTID	IN	NUMBER,
	iSTATE				IN	NUMBER
)
IS
BEGIN
----------------------------------------------------------------------------------------------------------
-- 작업구분
----------------------------------------------------------------------------------------------------------
    IF iJOBMODE = 'CREATE_MAPPINGINFO' THEN
        GOTO CREATE_MAPPINGINFO;
    ELSIF iJOBMODE = 'UPDATE_MAPPINGINFO' THEN
        GOTO UPDATE_MAPPINGINFO;
    ELSIF iJOBMODE = 'DELETE_MAPPINGINFO' THEN
        GOTO DELETE_MAPPINGINFO;
    END IF;
----------------------------------------------------------------------------------------------------------
-- Mapping 추가
----------------------------------------------------------------------------------------------------------
<<CREATE_MAPPINGINFO>>
	INSERT INTO STDCODE_GROUP_MAPPING (OBJECTID, GROUP_OBJECTID, MAPPING_OBJECTID, STATE, CREATE_DATE)
	VALUES (SEQ_STDCODE_GROUP_MAPPING.NEXTVAL, iGROUPOBJECTID, iMAPPINGOBJECTID, iSTATE, SYSDATE);
	RETURN;
----------------------------------------------------------------------------------------------------------
-- Mapping 수정
----------------------------------------------------------------------------------------------------------
<<UPDATE_MAPPINGINFO>>
	UPDATE	STDCODE_GROUP_MAPPING a
	SET		a.GROUP_OBJECTID	=	iGROUPOBJECTID,
			a.MAPPING_OBJECTID	=	iMAPPINGOBJECTID,
			a.STATE				=	iSTATE
	WHERE	a.OBJECTID	=	iOBJECTID;
	RETURN;
----------------------------------------------------------------------------------------------------------
-- Mapping 삭제
----------------------------------------------------------------------------------------------------------
<<DELETE_MAPPINGINFO>>
	DELETE FROM	STDCODE_GROUP_MAPPING
	WHERE		OBJECTID	=	iOBJECTID;
	RETURN;
----------------------------------------------------------------------------------------------------------
END SP_MAPPINGINFO_CUD;
